/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.loja.model.entity.compra;

import br.com.loja.model.entity.Switchable;
import br.com.loja.view.swing.model.FormField;
import br.com.loja.view.swing.model.IgnoreTableModel;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author David Luiz
 */
@Entity
@Table(name = "pedido_compra")
public class PedidoCompra implements Switchable, Serializable {

    public static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idPedidoCompra;
    @Temporal(TemporalType.DATE)
    private Calendar dataPedidoCompra;
    private BigDecimal valor;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pedidoCompra")
    private List<ItemPedidoCompra> itensPedidoCompra = new ArrayList<>();

    @FormField(visible = false)
    @IgnoreTableModel
    private boolean dead;

    public PedidoCompra() {
    }

    /**
     * @return the idPedidoCompra
     */
    public Long getIdPedidoCompra() {
        return idPedidoCompra;
    }

    /**
     * @param idPedidoCompra the idPedidoCompra to set
     */
    public void setIdPedidoCompra(Long idPedidoCompra) {
        this.idPedidoCompra = idPedidoCompra;
    }

    /**
     * @return the dataPedidoCompra
     */
    public Calendar getDataPedidoCompra() {
        return dataPedidoCompra;
    }

    /**
     * @param dataPedidoCompra the dataPedidoCompra to set
     */
    public void setDataPedidoCompra(Calendar dataPedidoCompra) {
        this.dataPedidoCompra = dataPedidoCompra;
    }

    /**
     * @return the valor
     */
    public BigDecimal getValor() {
        return valor;
    }

    /**
     * @param valor the valor to set
     */
    public void setValor(BigDecimal valor) {
        this.valor = valor;
    }

    /**
     * @return the itensPedidoCompra
     */
    public List<ItemPedidoCompra> getItensPedidoCompra() {
        return itensPedidoCompra;
    }

    /**
     * @param itensPedidoCompra the itensPedidoCompra to set
     */
    public void setItensPedidoCompra(List<ItemPedidoCompra> itensPedidoCompra) {
        this.itensPedidoCompra = itensPedidoCompra;
    }

    /**
     * @return the dead
     */
    public boolean isDead() {
        return dead;
    }

    /**
     * @param dead the dead to set
     */
    public void setDead(boolean dead) {
        this.dead = dead;
    }

}
